# -*- coding: utf-8 -*-
# Copyright 2011-2012 MagiCycles.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


LANGUAGE = ("en-us", "zh-cn",)
UNITS_DISTANCE = ("metric", "imperial",)

MEMBER_TYPE = ("Free", "Advanced", "VIP")
BIKE_TYPE = ("Road Bike", "Mountain Bike", "Urban", "Floding", "Other")
ROUTE_TYPE = ("gmap", "kml", "gpx")
PAGE_SIZE = 6

# public methods
class OutSites:
    Google = "Google"
    Weibo = "Weibo"

OutSitesTypes = [t for t in dir(OutSites) if not t.startswith("_")]


class ActivityType:
    CreateRoute = "Create a Route"
    AddBike = "Add a Bike"
    RemoveBike = "Remove a Bike"
    AddRide = "Add a Ride"
    AddFriend = "Add a Friend"
    DeFriend = "Defriend"
    JoinTeam = "Join Team"
    QuitTeam = "Quit Team"
    AddComment = "Add a Comment"
    AddFavorite = "Add Favorite"
    RemoveFavorite = "Remove Favorite"
    AddTeam = "Add a Team"
    DismissTeam = "Dismiss a Team"

ACTIVITY_TYPE = [getattr(ActivityType,t) for t in dir(ActivityType) if not t.startswith("_")]

ACTIVITY_POINT = {
    ActivityType.CreateRoute: 50,
    ActivityType.AddBike: 5,
    ActivityType.RemoveBike: 0,
    ActivityType.AddRide: 40,
    ActivityType.AddFriend: 5,
    ActivityType.DeFriend: -5,
    ActivityType.JoinTeam: 50,
    ActivityType.QuitTeam: -50,
    ActivityType.AddComment: 10,
    ActivityType.AddFavorite: 0,
    ActivityType.RemoveFavorite: 0,
    ActivityType.AddTeam: 100,
    ActivityType.DismissTeam: 100,
    }


VIP_POINT = 6000
ADV_POINT = 1000

class CommentCategory:
    text = "text"
    photo = "photo"
    food = "food"
    lodging = "lodging"
    sights = "sights"

COMMENT_CATEGORIES = [t for t in dir(CommentCategory) if not t.startswith("_")]

def PROPERTY(function):
    return property(**function())


class Error(Exception):
    """Base MagiCycle error type."""


class UserError(Error):
    """Base User error type."""

    def __init__(self, message="User error occured."):
        RuntimeError.__init__(self, message)
        self.message = message

    def __str__(self):
        return "<UserError: %s>" % (self.message)


class UserExistError(Error):
    """Raised when a user is exist."""


class UserNotExistError(Error):
    """Raised when a user is not exist."""


def main():
    pass

if __name__ == '__main__':
    main()
